package com.econ.powercloud.ems.service.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.econ.powercloud.ems.dal.entity.EmsProtectSoeConfig;
import com.econ.powercloud.ems.dal.mapper.EmsProtectSoeConfigMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author : zjf
 * @Description : EmsProtectSoeConfig dao层
 * @Date : 2022/8/3 14:37
 * @Modified by : zjf
 */
@Repository
public class EmsProtectSoeConfigDAO extends ServiceImpl<EmsProtectSoeConfigMapper, EmsProtectSoeConfig> {

    public List<EmsProtectSoeConfig> getListByInitDeviceCodeAndType(String initDeviceCode, Integer type){
        LambdaQueryWrapper<EmsProtectSoeConfig> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(StringUtils.isNoneBlank(initDeviceCode),EmsProtectSoeConfig::getInitDeviceCode,initDeviceCode);
        wrapper.eq(EmsProtectSoeConfig::getType,type);
        return this.baseMapper.selectList(wrapper);
    }
}
